package com.group.project.hrms.service.impl;

import com.group.project.hrms.entity.OvertimeRules;
import com.group.project.hrms.mapper.OvertimeRulesMapper;
import com.group.project.hrms.service.IOvertimeRulesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

@Service
public class OvertimeRulesService implements IOvertimeRulesService {

    @Autowired
    private OvertimeRulesMapper overtimeRulesMapper;

    @Override
    public int insertOvertimeRules(OvertimeRules overtimeRules) {
        return overtimeRulesMapper.insert(overtimeRules);
    }

    @Override
    public int deleteOvertimeRules(OvertimeRules overtimeRules) {
        return overtimeRulesMapper.deleteByPrimaryKey(overtimeRules);
    }

    @Override
    public int updateOvertimeRules(OvertimeRules overtimeRules) {
        return overtimeRulesMapper.updateByPrimaryKey(overtimeRules);
    }

    @Override
    public OvertimeRules selectOneOvertimeRules(OvertimeRules overtimeRules) {
        return null;
    }

    @Override
    public OvertimeRules selectOneOvertimeRulesByRuleId(String rid) {
        Example example = new Example(OvertimeRules.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("rulesId" , rid);
        return overtimeRulesMapper.selectOneByExample(example);
    }

    @Override
    public List<OvertimeRules> selectAllOvertimeRules() {
        return overtimeRulesMapper.selectAll();
    }
}
